package com.qh.physicsexperiment.domin;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qh.physicsexperiment.utils.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@TableName("classes")
@Data
@NoArgsConstructor  //空参构造方法
@AllArgsConstructor //全参构造方法
@Accessors(chain = true)//作用是使成员属性的set方法不再返回void，而是返回对象本身，从而实现链式赋值。
@EqualsAndHashCode(callSuper = true)//父类属性不参与equal
@ApiModel(value="Classes对象", description="班级信息")
public class Classes extends BaseEntity {
//    @ApiModelProperty(value = "逻辑删除，0：未删除，1：已删除")
//    @Null(groups = {Insert.class, Update.class}, message = "逻辑删除不用传")
//    @TableLogic
//    @TableField(select = false)
//    private Integer deleted;

    /**
     * 班级编号
     * 前两位为学院编号从10开始，两位专业编号，两位年纪，两位班级
     * 无自增，手动添加主键
     */
    //https://www.cnblogs.com/createImage/p/13750443.html
    @ApiModelProperty(value = "班级编码,两位代表学院，两位专业，两位年级，两位班级，无自增",required = true,dataType = "Long",allowableValues = "8")
    @Pattern(regexp = "^d{8}$",message = "班级编号不对")
    private Long id;

    /**
     * 老师编号
     */
    @ApiModelProperty(value = "老师编号",required = true,dataType = "Long",allowableValues = "4")
    @Pattern(regexp = "^d{4}$",message = "教师编号不对")
    private Long tid;

    /**
     * 班级
     */
    @ApiModelProperty(value = "班级",dataType = "Integer")
    @TableField(value = "class")
    private Integer classNum;

    /**
     * 年级
     */
    @ApiModelProperty(value = "年级",dataType = "Integer")
    private Integer grade;

    /**
     * 专业
     */
    @ApiModelProperty(value = "专业",dataType = "String")
    private String major;

    /**
     * 学院
     */
    @ApiModelProperty(value = "学院",dataType = "String")
    private String college;

    /**
     * 实验编码(用字符切割)
     */
    @ApiModelProperty(value = "实验编码",notes = "用'qh'隔开",dataType = "String",allowEmptyValue = true)
    private String expId;

    //反序列化唯一标识？没看懂
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}
